---
title: "AI Agent Usage"
description: "How to use AI Agents on AnythingLLM"
---

import { Cards, Card, Callout } from "nextra/components";
import {
  CardsIcon,
  RowsIcon,
  GlobeIcon,
  DiagramIcon,
  NewsletterIcon,
  FileIcon,
  BoxIcon,
  Database,
} from "/components/icons";
import Image from "next/image";

<Image
  src="/images/guides/ai-agents/usage.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AI Agent Usage"
/>

## How to use AI Agents?

<Callout type="warning" emoji="️⚠️">
  **Note**

    Before you use AI Agents, you have to configure your AI Agents by following our [Agent Setup Guide](/agent/setup)

</Callout>

Mention the agent by `@agent` to start an agent session. You can start an agent session anytime when using a workspace.

<Image
  src="/images/guides/ai-agents/trigger.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents Trigger"
/>

When you mention the agent, you will see a popup with the tools enabled for the agent on the workspace.

<br />
**Agents have access to the following tools:**

<Cards>
  <Card
    icon={<BoxIcon />}
    title="RAG Search"
    href="#what-is-rag-search-and-how-to-use-it"
  />
  <Card
    icon={<GlobeIcon />}
    title="Web Browsing"
    href="#what-is-web-browsing-and-how-to-use-it"
  />
  <Card
    icon={<RowsIcon />}
    title="Web Scraping"
    href="#what-is-web-scraping-and-how-to-use-it"
  />
  <Card
    icon={<FileIcon />}
    title="Save Files"
    href="#what-is-save-files-and-how-to-use-it"
  />
  <Card
    icon={<NewsletterIcon />}
    title="List Documents"
    href="#what-is-list-documents-and-how-to-use-it"
  />
  <Card
    icon={<CardsIcon />}
    title="Summarize Documents"
    href="#what-is-summarize-documents-and-how-to-use-it"
  />
  <Card
    icon={<DiagramIcon />}
    title="Chart Generation"
    href="#what-is-chart-generation-and-how-to-use-it"
  />
  <Card
    icon={<Database />}
    title="SQL Agent"
    href="#what-is-sql-agent-and-how-to-use-it"
  />
</Cards>

We will explained the intended use case of each tool below.

## What is RAG Search and how to use it?

RAG search allows the agent to check what are the things the agent already know about a specific topic (requires some data to be embedded in workspace)

You can use RAG search by asking the agent something like `@agent can you check what you already know about AnythingLLM?`

<Image
  src="/images/guides/ai-agents/rag-search.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents RAG Search"
/>

RAG search can update agent's own memory and that can be later used for recall in agent or regular chat. This embeds a virtual document you cannot manage.

Example: `Ah, great point. Can you summarize and save that summary for later to your memory`

## What is Web Browsing and how to use it?

Web Browsing tool allows the agent to search on internet and give you answer for your questions. This basically gives LLM the ability to access internet.

Example: `@agent can you do a web search for "What is the issue going on with MKBHD and Humane AI Pin?" and give me the key information that I need to know`

<Image
  src="/images/guides/ai-agents/browsing.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents Web Browsing"
/>

## What is Web Scraping and how to use it?

Web Scraping tool allows the agent to scrape a website and give you answer for your questions. This embeds a website's content into the workspace and asking question to the LLM to respond based on the content on the embedded website, with agent you don't have to manually embed the website -- the agent will do it automatically for you.

Example: `@agent can you scrape the website anythingllm.com and give me a summary of features AnythingLLM have?`

<Image
  src="/images/guides/ai-agents/scrape.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents Web Scraping"
/>

## What is Save Files and how to use it?

Save Files tool allows the agent to save any information into a file on your local machine.

Example: `@agent can save this information as a PDF on my desktop folder?`

<Image
  src="/images/guides/ai-agents/saving.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents Save Files"
/>

<Callout type="info" emoji="️💡">
  **Note**

    AnythingLLM will show you an popup to choose the file location and file name to save the file.

</Callout>

## What is List Documents and how to use it?

List Documents tool allows the agent to see and tell you all the documents it can access (documents that are embedded in the workspace)

Example: `@agent could you please tell me the list of files you can access now?`

<Image
  src="/images/guides/ai-agents/list-document.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents List Documents"
/>

## What is Summarize Documents and how to use it?

Summarize Documents tool allows the agent to give you a summary of a document.

Example: `@agent can you summarize the content on https://docs.anythingllm.com/features/chat-logs`

<Image
  src="/images/guides/ai-agents/summarize.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents Summarize Documents"
/>

## What is Chart Generation and how to use it?

Chart Generation tool allows the agent to create charts based on the given prompt/data.

Example 1: `@agent can you plot y=mx+b where m=10 and b=0?`

Example 2: `@agent can you look at data.csv and plot that as a pie chat by age?` (_assuming data.csv is in the workspace_)

<Image
  src="/images/guides/ai-agents/graph.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents Chart Generation"
/>

## What is SQL Agent and how to use it?

The built-in SQL agent is a skill that you can leverage to run real-time analytics and queries against a real relational database. The agent can do all of the following:

- `list-databases`: View its current connections and sources it can leverage.
- `list-tables`: View all of the available tables within a database.
- `check-table-schema`: Check the available columns of a table for types and possible value stores.
- `query`: Run a valid SQL query on a database to product a set of `rows` that will later be used in your answer.

<Callout type="warning" emoji="️🔧">
  **Caution!**

You should use the SQL agent with a <b>read-only</b> database user. While the agent is instructed to not provide anything other than SELECT statements, this does not prevent it from running other SQL commands that could modify your data!

</Callout>

_Example 1:_ <br/>
`@agent can you summarize all of the sales volume for May 2024 in the backend-office DB?`

_Example 2:_ (_assuming you have the `save-file` skill enabled_)<br/>
`@agent can you grab the emails of the most recent 10 customers and save that to customer.csv?`

<Image
  src="/images/guides/ai-agents/sql-agent.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents SQL Agent skill"
/>

## Frequently Asked Questions

### 1) How can I know if the agent session is started or ended?

When a Agent session is started you will see the log `Agent @agent invoked` on your chat.

When a Agent session is ended you will see the log `Agent session completed` on your chat.

<Image
  src="/images/guides/ai-agents/start-end.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents"
/>

### 2) How can I end a Agent Session?

Simply use the slash command `/exit` to end a agent session

<Image
  src="/images/guides/ai-agents/end-slash-command.png"
  height={1080}
  width={1920}
  quality={100}
  alt="AnythingLLM AI Agents"
/>

### 3) Do I have to always mention `@agent` to interact with the agent?

No, you only have to use `@agent` to start an agent session, during the agent session you don't have to mention the agent by `@agent`, you can just keep chatting with the agent like you chat with an LLM.

### 4) My Agent says it cannot access the internet, what can I do?

This is because of the LLM you are using, not all LLMs are great of even useable for `tool-calling`. With AnythingLLM we make every model possible to be used as an agent, but the strength of your model to comprehend the instruction and examples of tool calling is still reliant on the model itself. Smaller models with 4-Bit Quantization won't respond properly as an agent most times, but the very same model at 8Bit Quantization will give better response as an Agent -- same LLM but different quantization. If your agent is not responding properly then try using a higher quantization model or a larger model altoghether.

### 5) My Agent says it saved a file on my machine, but when I checked the location there is no file like the agent mentioned, what can I do?

If you dont see `@agent is attempting to call save-file-to-browser` when you ask, it never really called the tool and just pretended it did, AKA: **Hallunicated**.

To fix this issue you can do one of the following things:

- Be more explicit and say verbatim for it to call the specific tool `save-file-to-browser`
- Use a better model that is more capable of tool calling.
